import java.sql.SQLOutput;
import java.util.Random;
import java.util.Scanner;
//猜数字游戏
public class play {
    public static void main(String[] args) {
        Random random = new Random();
        int randNum = random.nextInt(100); //生成一个随机数，[0-100),根据此时刻时间决定
        //randNum = random.nextInt(例如123); 生成一个固定数
        System.out.println("生成的随机数字为："+randNum);
        Scanner scanner = new Scanner(System.in);
        while(true){
            System.out.println("请输入你要猜的数字:");
            int num = scanner.nextInt();
            if(num > randNum){
                System.out.println("猜大了！！！");
            } else if (num < randNum){
                System.out.println("猜小了！！！");
            }else {
                System.out.println("猜对了！！！");
                break;
            }
        }
    }
}
